<template>
  <img
      :style="styleObj"
      class="avatar"
      :src="avatarImg"
      alt=""
  >
</template>

<script>
export default {
  name: "avatar",
  props: {
    avatar: String,
    size: {
      type: Number,
      default: 50,
    }
  },
  data() {
    return{
      styleObj:{
        width: this.size + 'px',
        height: this.size + 'px',
      }
    }
  },
  computed:{
    avatarImg() {
      return this.avatar || this.userInfo.avatar || process.env.VUE_APP_APP_Default_Avatar
    }
  }
}
</script>

<style scoped>
.avatar{
  border-radius: 50%;
}
</style>